package com.juku2024.juku.tools

import android.widget.Toast
import com.juku2024.juku.base.BaseApplication
import java.lang.Exception

object AlertUtils {

    private var toast: Toast? = null

    /**
     * 解决Toast重复弹出 长时间不消失的问题
     *
     * @param message
     */
    fun alert(message: String) {
        try {
            if (toast == null) {
                toast = Toast.makeText(BaseApplication.context, message, Toast.LENGTH_LONG)
            } else {
                toast?.setText(message)
            }
            toast?.show()
        }catch (e: Exception) {
            e.printStackTrace()
        }
    }
}